package com.bot.edu.employmentsystem.resume.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.bot.edu.noticessystem.notices.entity.Notices;
import com.bot.edu.noticessystem.notices.service.INoticesService;
import com.bot.edu.utils.ToNotices;
import org.jeecgframework.poi.excel.ExcelImportUtil;
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
import org.jeecgframework.poi.excel.entity.ExportParams;
import org.jeecgframework.poi.excel.entity.ImportParams;
import org.jeecgframework.poi.excel.view.JeecgEntityExcelView;
import org.jeecg.common.system.vo.LoginUser;
import org.apache.shiro.SecurityUtils;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.query.QueryGenerator;
import org.jeecg.common.util.oConvertUtils;
import com.bot.edu.employmentsystem.resume.entity.EducationExperience;
import com.bot.edu.employmentsystem.resume.entity.PositonIntention;
import com.bot.edu.employmentsystem.resume.entity.ProjectExperience;
import com.bot.edu.employmentsystem.resume.entity.WorkExperience;
import com.bot.edu.employmentsystem.resume.entity.EmploymentResume;
import com.bot.edu.employmentsystem.resume.vo.EmploymentResumePage;
import com.bot.edu.employmentsystem.resume.service.IEmploymentResumeService;
import com.bot.edu.employmentsystem.resume.service.IEducationExperienceService;
import com.bot.edu.employmentsystem.resume.service.IPositonIntentionService;
import com.bot.edu.employmentsystem.resume.service.IProjectExperienceService;
import com.bot.edu.employmentsystem.resume.service.IWorkExperienceService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.jeecg.common.aspect.annotation.AutoLog;

 /**
 * @Description: 简历表
 * @Author: jeecg-boot
 * @Date:   2022-04-02
 * @Version: V1.0
 */
@Api(tags="简历表")
@RestController
@RequestMapping("/resume/employmentResume")
@Slf4j
public class EmploymentResumeController {
	@Autowired
	private IEmploymentResumeService employmentResumeService;
	@Autowired
	private IEducationExperienceService educationExperienceService;
	@Autowired
	private IPositonIntentionService positonIntentionService;
	@Autowired
	private IProjectExperienceService projectExperienceService;
	@Autowired
	private IWorkExperienceService workExperienceService;
     @Autowired
     private INoticesService noticesService;
	
	/**
	 * 分页列表查询
	 *
	 * @param employmentResume
	 * @param pageNo
	 * @param pageSize
	 * @param req
	 * @return
	 */
	@AutoLog(value = "简历表-分页列表查询")
	@ApiOperation(value="简历表-分页列表查询", notes="简历表-分页列表查询")
	@GetMapping(value = "/list")
	public Result<?> queryPageList(EmploymentResume employmentResume,
								   @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
								   @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
								   HttpServletRequest req) {
		QueryWrapper<EmploymentResume> queryWrapper = QueryGenerator.initQueryWrapper(employmentResume, req.getParameterMap());
		Page<EmploymentResume> page = new Page<EmploymentResume>(pageNo, pageSize);
		IPage<EmploymentResume> pageList = employmentResumeService.page(page, queryWrapper);
		return Result.OK(pageList);
	}
	
	/**
	 *   添加
	 *
	 * @param employmentResumePage
	 * @return
	 */
	@AutoLog(value = "简历表-添加")
	@ApiOperation(value="简历表-添加", notes="简历表-添加")
	@PostMapping(value = "/add")
	public Result<?> add(@RequestBody EmploymentResumePage employmentResumePage) {
		EmploymentResume employmentResume = new EmploymentResume();
		BeanUtils.copyProperties(employmentResumePage, employmentResume);
		employmentResumeService.saveMain(employmentResume, employmentResumePage.getEducationExperienceList(),employmentResumePage.getPositonIntentionList(),employmentResumePage.getProjectExperienceList(),employmentResumePage.getWorkExperienceList());
		return Result.OK("添加成功！");
	}
	
	/**
	 *  编辑
	 *
	 * @param employmentResumePage
	 * @return
	 */
	@AutoLog(value = "简历表-编辑")
	@ApiOperation(value="简历表-编辑", notes="简历表-编辑")
	@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
	public Result<?> edit(@RequestBody EmploymentResumePage employmentResumePage) {
		EmploymentResume employmentResume = new EmploymentResume();
		BeanUtils.copyProperties(employmentResumePage, employmentResume);
		EmploymentResume employmentResumeEntity = employmentResumeService.getById(employmentResume.getId());
		if(employmentResumeEntity==null) {
			return Result.error("未找到对应数据");
		}
		employmentResumeService.updateMain(employmentResume, employmentResumePage.getEducationExperienceList(),employmentResumePage.getPositonIntentionList(),employmentResumePage.getProjectExperienceList(),employmentResumePage.getWorkExperienceList());
		return Result.OK("编辑成功!");
	}
	
	/**
	 *   通过id删除
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "简历表-通过id删除")
	@ApiOperation(value="简历表-通过id删除", notes="简历表-通过id删除")
	@DeleteMapping(value = "/delete")
	public Result<?> delete(@RequestParam(name="id",required=true) String id) {
		employmentResumeService.delMain(id);
		return Result.OK("删除成功!");
	}
	
	/**
	 *  批量删除
	 *
	 * @param ids
	 * @return
	 */
	@AutoLog(value = "简历表-批量删除")
	@ApiOperation(value="简历表-批量删除", notes="简历表-批量删除")
	@DeleteMapping(value = "/deleteBatch")
	public Result<?> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
		this.employmentResumeService.delBatchMain(Arrays.asList(ids.split(",")));
		return Result.OK("批量删除成功！");
	}
	
	/**
	 * 通过id查询
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "简历表-通过id查询")
	@ApiOperation(value="简历表-通过id查询", notes="简历表-通过id查询")
	@GetMapping(value = "/queryById")
	public Result<?> queryById(@RequestParam(name="id",required=true) String id) {
		EmploymentResume employmentResume = employmentResumeService.getById(id);
		if(employmentResume==null) {
			return Result.error("未找到对应数据");
		}
		return Result.OK(employmentResume);

	}
	
	/**
	 * 通过id查询
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "教育经历表通过主表ID查询")
	@ApiOperation(value="教育经历表主表ID查询", notes="教育经历表-通主表ID查询")
	@GetMapping(value = "/queryEducationExperienceByMainId")
	public Result<?> queryEducationExperienceListByMainId(@RequestParam(name="id",required=true) String id) {
		List<EducationExperience> educationExperienceList = educationExperienceService.selectByMainId(id);
		return Result.OK(educationExperienceList);
	}
	/**
	 * 通过id查询
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "求职意向表通过主表ID查询")
	@ApiOperation(value="求职意向表主表ID查询", notes="求职意向表-通主表ID查询")
	@GetMapping(value = "/queryPositonIntentionByMainId")
	public Result<?> queryPositonIntentionListByMainId(@RequestParam(name="id",required=true) String id) {
		List<PositonIntention> positonIntentionList = positonIntentionService.selectByMainId(id);
		return Result.OK(positonIntentionList);
	}
	/**
	 * 通过id查询
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "项目经历表通过主表ID查询")
	@ApiOperation(value="项目经历表主表ID查询", notes="项目经历表-通主表ID查询")
	@GetMapping(value = "/queryProjectExperienceByMainId")
	public Result<?> queryProjectExperienceListByMainId(@RequestParam(name="id",required=true) String id) {
		List<ProjectExperience> projectExperienceList = projectExperienceService.selectByMainId(id);
		return Result.OK(projectExperienceList);
	}
	/**
	 * 通过id查询
	 *
	 * @param id
	 * @return
	 */
	@AutoLog(value = "工作经历表通过主表ID查询")
	@ApiOperation(value="工作经历表主表ID查询", notes="工作经历表-通主表ID查询")
	@GetMapping(value = "/queryWorkExperienceByMainId")
	public Result<?> queryWorkExperienceListByMainId(@RequestParam(name="id",required=true) String id) {
		List<WorkExperience> workExperienceList = workExperienceService.selectByMainId(id);
		return Result.OK(workExperienceList);
	}

    /**
    * 导出excel
    *
    * @param request
    * @param employmentResume
    */
    @RequestMapping(value = "/exportXls")
    public ModelAndView exportXls(HttpServletRequest request, EmploymentResume employmentResume) {
      // Step.1 组装查询条件查询数据
      QueryWrapper<EmploymentResume> queryWrapper = QueryGenerator.initQueryWrapper(employmentResume, request.getParameterMap());
      LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();

      //Step.2 获取导出数据
      List<EmploymentResume> queryList = employmentResumeService.list(queryWrapper);
      // 过滤选中数据
      String selections = request.getParameter("selections");
      List<EmploymentResume> employmentResumeList = new ArrayList<EmploymentResume>();
      if(oConvertUtils.isEmpty(selections)) {
          employmentResumeList = queryList;
      }else {
          List<String> selectionList = Arrays.asList(selections.split(","));
          employmentResumeList = queryList.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
      }

      // Step.3 组装pageList
      List<EmploymentResumePage> pageList = new ArrayList<EmploymentResumePage>();
      for (EmploymentResume main : employmentResumeList) {
          EmploymentResumePage vo = new EmploymentResumePage();
          BeanUtils.copyProperties(main, vo);
          List<EducationExperience> educationExperienceList = educationExperienceService.selectByMainId(main.getId());
          vo.setEducationExperienceList(educationExperienceList);
          List<PositonIntention> positonIntentionList = positonIntentionService.selectByMainId(main.getId());
          vo.setPositonIntentionList(positonIntentionList);
          List<ProjectExperience> projectExperienceList = projectExperienceService.selectByMainId(main.getId());
          vo.setProjectExperienceList(projectExperienceList);
          List<WorkExperience> workExperienceList = workExperienceService.selectByMainId(main.getId());
          vo.setWorkExperienceList(workExperienceList);
          pageList.add(vo);
      }

      // Step.4 AutoPoi 导出Excel
      ModelAndView mv = new ModelAndView(new JeecgEntityExcelView());
      mv.addObject(NormalExcelConstants.FILE_NAME, "简历表列表");
      mv.addObject(NormalExcelConstants.CLASS, EmploymentResumePage.class);
      mv.addObject(NormalExcelConstants.PARAMS, new ExportParams("简历表数据", "导出人:"+sysUser.getRealname(), "简历表"));
      mv.addObject(NormalExcelConstants.DATA_LIST, pageList);
      return mv;
    }

    /**
    * 通过excel导入数据
    *
    * @param request
    * @param response
    * @return
    */
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
      MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
      Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
      for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
          MultipartFile file = entity.getValue();// 获取上传文件对象
          ImportParams params = new ImportParams();
          params.setTitleRows(2);
          params.setHeadRows(1);
          params.setNeedSave(true);
          try {
              List<EmploymentResumePage> list = ExcelImportUtil.importExcel(file.getInputStream(), EmploymentResumePage.class, params);
              for (EmploymentResumePage page : list) {
                  EmploymentResume po = new EmploymentResume();
                  BeanUtils.copyProperties(page, po);
                  employmentResumeService.saveMain(po, page.getEducationExperienceList(),page.getPositonIntentionList(),page.getProjectExperienceList(),page.getWorkExperienceList());
              }
              return Result.OK("文件导入成功！数据行数:" + list.size());
          } catch (Exception e) {
              log.error(e.getMessage(),e);
              return Result.error("文件导入失败:"+e.getMessage());
          } finally {
              try {
                  file.getInputStream().close();
              } catch (IOException e) {
                  e.printStackTrace();
              }
          }
      }
      return Result.OK("文件导入失败！");
    }

	 /**
	  * 修改简历状态
	  */
	 @GetMapping("updateResumeState")
	 public Result<String> updateResumeState(String id,Integer stateNum){
		 QueryWrapper<EmploymentResume> queryWrapper = new QueryWrapper<>();
		 queryWrapper.lambda().eq(EmploymentResume::getId,id);
		 EmploymentResume employmentResume = new EmploymentResume();
		 employmentResume.setResumeState(stateNum);
		 boolean update = employmentResumeService.update(employmentResume, queryWrapper);
		 if (update!=false){
             Notices notices = ToNotices.toNotices( "您的简历已审核，请在审核记录中查看详情");
             noticesService.save(notices);
			 return Result.ok("审核提交成功！");
		 }
		 return Result.error("审核提交失败！");
	 }

	 /**
	  * 通过学生id查询
	  *
	  * @param stuId
	  * @return
	  */
	 @AutoLog(value = "简历表-通过学生id查询")
	 @ApiOperation(value="简历表-通过学生id查询", notes="简历表-通过学生id查询")
	 @GetMapping(value = "/queryStuById")
	 public Result<?> queryStuById(@RequestParam(name="stuId",required=true) String stuId) {
		 //查询学生简历
		 QueryWrapper<EmploymentResume> resumeQueryWrapper = new QueryWrapper<>();
		 resumeQueryWrapper.lambda().eq(EmploymentResume::getStuId,stuId);
		 EmploymentResume resumeList = employmentResumeService.getOne(resumeQueryWrapper);
		 //根据简历编号查询求职意向
		 QueryWrapper<PositonIntention> positonIntentionQueryWrapper = new QueryWrapper<>();
		 positonIntentionQueryWrapper.lambda().eq(PositonIntention::getResumeId,resumeList.getId());
		 List<PositonIntention> positonIntentionList = positonIntentionService.list(positonIntentionQueryWrapper);
		 //根据简历编号查询教育经历
		 QueryWrapper<EducationExperience> educationExperienceQueryWrapper = new QueryWrapper<>();
		 educationExperienceQueryWrapper.lambda().eq(EducationExperience::getResumeId,resumeList.getId());
		 List<EducationExperience> educationExperienceList = educationExperienceService.list(educationExperienceQueryWrapper);
		 //根据简历编号查询工作经历
		 QueryWrapper<WorkExperience> workExperienceQueryWrapper = new QueryWrapper<>();
		 workExperienceQueryWrapper.lambda().eq(WorkExperience::getResumeId,resumeList.getId());
		 List<WorkExperience> workExperienceList = workExperienceService.list(workExperienceQueryWrapper);
		 //根据简历编号查询项目经历
		 QueryWrapper<ProjectExperience> projectExperienceQueryWrapper = new QueryWrapper<>();
		 projectExperienceQueryWrapper.lambda().eq(ProjectExperience::getResumeId,resumeList.getId());
		 List<ProjectExperience> projectExperienceList = projectExperienceService.list(projectExperienceQueryWrapper);
		 //赋值到简历属性
		 resumeList.setPositonIntentionList(positonIntentionList);
		 resumeList.setEducationExperienceList(educationExperienceList);
		 resumeList.setWorkExperienceList(workExperienceList);
		 resumeList.setProjectExperienceList(projectExperienceList);
		 if(resumeList==null) {
			 return Result.error("未找到对应数据");
		 }
		 return Result.OK(resumeList);
	 }

     /**
      * 通过id查询
      *
      * @param stuId
      * @return
      */
     @AutoLog(value = "通过学生ID查询简历")
     @ApiOperation(value="通过学生ID查询简历", notes="通过学生ID查询简历")
     @GetMapping(value = "/showStuById")
     public Result<?> showStuById(@RequestParam(name="stuId",required=true) String stuId) {
         QueryWrapper<EmploymentResume> queryWrapper = new QueryWrapper<>();
         queryWrapper.lambda().eq(EmploymentResume::getStuId,stuId);
         EmploymentResume employmentResume = employmentResumeService.getOne(queryWrapper);
         if (employmentResume!=null){
			 return Result.OK(employmentResume);
		 }
		 return Result.error("查询失败！");
     }

	 /**
	  * 通过id修改
	  *
	  * @param employmentResume
	  * @return
	  */
	 @AutoLog(value = "通过id修改")
	 @ApiOperation(value="通过id修改", notes="通过id修改")
	 @PostMapping(value = "/upResumeById")
	 public Result<?> upResumeById(@RequestBody EmploymentResume employmentResume) {
		 boolean b = employmentResumeService.updateById(employmentResume);
		 if (b!=false){
			 return Result.OK("编辑成功");
		 }
		 return Result.error("编辑失败");
	 }

	 /**
	  * 新增简历
	  *
	  * @param employmentResume
	  * @return
	  */
	 @AutoLog(value = "新增简历")
	 @ApiOperation(value="新增简历", notes="新增简历")
	 @PostMapping(value = "/addResume")
	 public Result<?> addResume(@RequestBody EmploymentResume employmentResume) {
		 boolean b = employmentResumeService.save(employmentResume);
		 if (b!=false){
			 return Result.OK("新增成功");
		 }
		 return Result.error("新增失败");
	 }

	 /**
	  * 新增求职意向
	  *
	  * @param positonIntention
	  * @return
	  */
	 @AutoLog(value = "新增求职意向")
	 @ApiOperation(value="新增求职意向", notes="新增求职意向")
	 @PostMapping(value = "/addPositonIntention")
	 public Result<?> addPositonIntention(@RequestBody PositonIntention positonIntention) {
		 boolean b = positonIntentionService.save(positonIntention);
		 if (b!=false){
			 return Result.OK("新增成功");
		 }
		 return Result.error("新增失败");
	 }

	 /**
	  * 修改求职意向
	  *
	  * @param positonIntention
	  * @return
	  */
	 @AutoLog(value = "修改求职意向")
	 @ApiOperation(value="修改求职意向", notes="修改求职意向")
	 @PostMapping(value = "/upPositonIntention")
	 public Result<?> upPositonIntention(@RequestBody PositonIntention positonIntention) {
		 boolean b = positonIntentionService.updateById(positonIntention);
		 if (b!=false){
			 return Result.OK("修改成功");
		 }
		 return Result.error("修改失败");
	 }

	 /**
	  * 通过id查询求职意向表
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "通过id查询求职意向表")
	 @ApiOperation(value="通过id查询求职意向表", notes="通过id查询求职意向表")
	 @GetMapping(value = "/queryPositonIntentionListById")
	 public Result<?> queryPositonIntentionListById(@RequestParam(name="id",required=true) String id) {
		 PositonIntention positonIntention = positonIntentionService.getById(id);
		 return Result.OK(positonIntention);
	 }

	 /**
	  * 删除求职意向
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "删除求职意向")
	 @ApiOperation(value="删除求职意向", notes="删除求职意向")
	 @GetMapping(value = "/delPositonIntentionListById")
	 public Result<?> delPositonIntentionListById(@RequestParam(name="id",required=true) String id) {
		 boolean b = positonIntentionService.removeById(id);
		 if (b==true){
			 return Result.OK("删除成功");
		 }
		 return Result.error("删除失败");
	 }

	 /**
	  * 新增教育经历
	  *
	  * @param educationExperience
	  * @return
	  */
	 @AutoLog(value = "新增教育经历")
	 @ApiOperation(value="新增教育经历", notes="新增教育经历")
	 @PostMapping(value = "/addEducationExperience")
	 public Result<?> addEducationExperience(@RequestBody EducationExperience educationExperience) {
		 boolean b = educationExperienceService.save(educationExperience);
		 if (b!=false){
			 return Result.OK("新增成功");
		 }
		 return Result.error("新增失败");
	 }

	 /**
	  * 通过id查询教育经历表
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "通过id查询教育经历表")
	 @ApiOperation(value="通过id查询教育经历表", notes="通过id查询教育经历表")
	 @GetMapping(value = "/queryEducationExperienceById")
	 public Result<?> queryEducationExperienceById(@RequestParam(name="id",required=true) String id) {
		 EducationExperience educationExperience = educationExperienceService.getById(id);
		 return Result.OK(educationExperience);
	 }

	 /**
	  * 修改教育经历
	  *
	  * @param educationExperience
	  * @return
	  */
	 @AutoLog(value = "修改教育经历")
	 @ApiOperation(value="修改教育经历", notes="修改教育经历")
	 @PostMapping(value = "/upEducationExperience")
	 public Result<?> upEducationExperience(@RequestBody EducationExperience educationExperience) {
		 boolean b = educationExperienceService.updateById(educationExperience);
		 if (b!=false){
			 return Result.OK("修改成功");
		 }
		 return Result.error("修改失败");
	 }

	 /**
	  * 删除教育经历
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "删除教育经历")
	 @ApiOperation(value="删除教育经历", notes="删除教育经历")
	 @GetMapping(value = "/delEducationExperienceById")
	 public Result<?> delEducationExperienceById(@RequestParam(name="id",required=true) String id) {
		 boolean b = educationExperienceService.removeById(id);
		 if (b==true){
			 return Result.OK("删除成功");
		 }
		 return Result.error("删除失败");
	 }

	 /**
	  * 新增工作经历
	  *
	  * @param workExperience
	  * @return
	  */
	 @AutoLog(value = "新增工作经历")
	 @ApiOperation(value="新增工作经历", notes="新增工作经历")
	 @PostMapping(value = "/addWorkExperience")
	 public Result<?> addWorkExperience(@RequestBody WorkExperience workExperience) {
		 boolean b = workExperienceService.save(workExperience);
		 if (b!=false){
			 return Result.OK("新增成功");
		 }
		 return Result.error("新增失败");
	 }

	 /**
	  * 通过id查询工作经历表
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "通过id查询工作经历表")
	 @ApiOperation(value="通过id查询工作经历表", notes="通过id查询工作经历表")
	 @GetMapping(value = "/queryWorkExperienceById")
	 public Result<?> queryWorkExperienceById(@RequestParam(name="id",required=true) String id) {
		 WorkExperience workExperience = workExperienceService.getById(id);
		 return Result.OK(workExperience);
	 }

	 /**
	  * 修改工作经历
	  *
	  * @param workExperience
	  * @return
	  */
	 @AutoLog(value = "修改工作经历")
	 @ApiOperation(value="修改工作经历", notes="修改工作经历")
	 @PostMapping(value = "/upWorkExperience")
	 public Result<?> upWorkExperience(@RequestBody WorkExperience workExperience) {
		 boolean b = workExperienceService.updateById(workExperience);
		 if (b!=false){
			 return Result.OK("修改成功");
		 }
		 return Result.error("修改失败");
	 }

	 /**
	  * 删除工作经历
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "删除工作经历")
	 @ApiOperation(value="删除工作经历", notes="删除工作经历")
	 @GetMapping(value = "/delWorkExperienceById")
	 public Result<?> delWorkExperienceById(@RequestParam(name="id",required=true) String id) {
		 boolean b = workExperienceService.removeById(id);
		 if (b==true){
			 return Result.OK("删除成功");
		 }
		 return Result.error("删除失败");
	 }

	 /**
	  * 新增项目经历
	  *
	  * @param projectExperience
	  * @return
	  */
	 @AutoLog(value = "新增项目经历")
	 @ApiOperation(value="新增项目经历", notes="新增项目经历")
	 @PostMapping(value = "/addProjectExperience")
	 public Result<?> addProjectExperience(@RequestBody ProjectExperience projectExperience) {
		 boolean b = projectExperienceService.save(projectExperience);
		 if (b!=false){
			 return Result.OK("新增成功");
		 }
		 return Result.error("新增失败");
	 }

	 /**
	  * 通过id查询项目经历表
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "通过id查询项目经历表")
	 @ApiOperation(value="通过id查询项目经历表", notes="通过id查询项目经历表")
	 @GetMapping(value = "/queryProjectExperienceById")
	 public Result<?> queryProjectExperienceById(@RequestParam(name="id",required=true) String id) {
		 ProjectExperience projectExperience = projectExperienceService.getById(id);
		 return Result.OK(projectExperience);
	 }

	 /**
	  * 修改项目经历
	  *
	  * @param projectExperience
	  * @return
	  */
	 @AutoLog(value = "修改项目经历")
	 @ApiOperation(value="修改项目经历", notes="修改项目经历")
	 @PostMapping(value = "/upProjectExperience")
	 public Result<?> upProjectExperience(@RequestBody ProjectExperience projectExperience) {
		 boolean b = projectExperienceService.updateById(projectExperience);
		 if (b!=false){
			 return Result.OK("修改成功");
		 }
		 return Result.error("修改失败");
	 }

	 /**
	  * 删除项目经历
	  *
	  * @param id
	  * @return
	  */
	 @AutoLog(value = "删除项目经历")
	 @ApiOperation(value="删除项目经历", notes="删除项目经历")
	 @GetMapping(value = "/delProjectExperienceById")
	 public Result<?> delProjectExperienceById(@RequestParam(name="id",required=true) String id) {
		 boolean b = projectExperienceService.removeById(id);
		 if (b==true){
			 return Result.OK("删除成功");
		 }
		 return Result.error("删除失败");
	 }

	 /**
	  * 删除项目经历
	  *
	  * @param resumeAttachment
	  * @return
	  */
	 @AutoLog(value = "修改简历附件")
	 @ApiOperation(value="修改简历附件", notes="修改简历附件")
	 @GetMapping(value = "/upResumeAttachment")
	 public Result<?> upResumeAttachment(@RequestParam String resumeId,@RequestParam String resumeAttachment) {
		 EmploymentResume employmentResume = new EmploymentResume();
		 employmentResume.setId(resumeId);
		 employmentResume.setResumeAttachment(resumeAttachment);
		 boolean b = employmentResumeService.updateById(employmentResume);
		 if (b==true){
			 return Result.OK("上传成功");
		 }
		 return Result.error("上传失败");
	 }
 }
